package com.dhl.command;

import com.dhl.command.tv.TVOffCommand;
import com.dhl.command.tv.TVOnCommand;
import com.dhl.command.tv.TVReceiver;

/**
 * @title: Cilent
 * @Author danghailiang
 * @Date: 2022/8/20 11:57
 * @Version 1.0
 */
public class Client {
    public static void main(String[] args) {
        RemoteController remoteController = new RemoteController();
        // 创建电视接收器
        TVReceiver tvReceiver = new TVReceiver();
        // 设置命令
        remoteController.setCommand(
                0,
                new TVOnCommand(tvReceiver),
                new TVOffCommand(tvReceiver)
        );
        // 通过指定打开 开的 按钮
        remoteController.onButtonWasPushed(0);
        // 通知控制， 关闭TV
        remoteController.offButtonWasPushed(0);
        // 撤销该操作
        remoteController.setUndoCommand();
    }
}
